﻿using IceDog.Uop.Utils;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace IceDog.Uop.Models
{
    public class Order
    {
        public Order()
        {
            Guid = GUIDHelper.GuidString;
            CreateTime = DateTime.Now;
        }
        /// <summary>
        /// 订单id
        /// <para>[可以不用赋值，内部赋值]</para>
        /// </summary>

        [Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]//主键，自动递增
        public int Id { get; set; }
        /// <summary>
        /// 订单Guid
        /// <para>[可以不用赋值，内部赋值]</para>
        /// </summary>
        public string Guid { get; set; }
        /// <summary>
        /// 订单创建时间
        /// <para>[可以不用赋值，内部赋值]</para>
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 订单完结时间（付款后的时间）
        /// </summary>
        public DateTime EndTime { get; set; }
        /// <summary>
        /// 用户Id
        /// </summary>
        public int UserId { get; set; }
        /// <summary>
        /// 用户
        /// </summary>
        public User User { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        /// <summary>
        /// 订单产品集合
        /// </summary>
        public IList<OrderDetail> OrderDetails { get; set; }
    }
}
